home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / utility / utilrexx / mkrmged.lha / makereadme.ged < prev    next >
Text File  |  1996-12-29  |  6KB  |  211 lines

  1. /* MakeReadMe.ged by Roy E Brown <roy@ebrown.demon.co.uk>
  2.  
  3.    $vers MakeReadMe.ged V1.3 (29.12.96)
  4.  
  5.    For use with GoldED.
  6.  
  7.    Based on the scripts for CED and FSE with similar names by Kenneth C. Nilsen
  8.  
  9.    Thanks must also go to Eric Gerard for a couple of suggestions.
  10.  
  11.    This AREXX script will make a .readme header for use with AmiNet uploads.
  12.  
  13.    It must be called from within GoldEd, and it requires the Aminet TREE file -
  14.    with minor modifications - which is included in the archive.
  15.  
  16.    Please modify the 'Author' and 'Uploader' variables.
  17. */
  18.  
  19. Options Results                             /* enable return codes     */
  20.  
  21. If (Left(Address(),6)~="GOLDED") Then       /* not started by GoldEd ? */
  22.     Address 'GOLDED.1'
  23.  
  24. 'LOCK CURRENT RELEASE=4'                    /* lock GUI, gain access   */
  25. If (RC ~= 0) Then
  26.     Exit
  27.  
  28. Options Failat 6                            /* ignore warnings         */
  29. Signal On Syntax                            /* ensure clean exit       */
  30.  
  31. /***** Start of my code *****/
  32.  
  33. /******** CHANGE THE NEXT 2 LINES TO YOUR REQUIREMENTS ********/
  34.  
  35. Author   ="roy@ebrown.demon.co.uk (Roy E Brown)"
  36. Uploader ="Author"
  37.  
  38. /******** CHANGE THE ABOVE 2 LINES TO YOUR REQUIREMENTS ********/
  39.  
  40. DirList=''
  41. SubList=''
  42. Titel="MakeReadMe V1.3 1996 Roy E Brown"
  43.  
  44. 'REQUEST TITLE="'Titel'"
  45.          BODY="This script will create the|header lines required for a|standard Aminet .readme file"
  46.          BUTTON="OK"'
  47.  
  48. If ~Exists('GoldEd:ARexx/TREE')=1 Then
  49.   Do
  50.     'REQUEST PROBLEM "Aminet Directory list not found"'
  51.     'UNLOCK'
  52.      Exit
  53.   End
  54.  
  55. /* Read the Aminet Directory Tree */
  56.  
  57. If Open(AmiTree,'GoldEd:ARexx/TREE',r)=1 Then
  58.   n=0
  59.   Do Until EOF(AmiTree)
  60.      List=ReadLn(AmiTree)
  61.      MainDir.n=Compress(Left(List,(Index(List,'/'))),'/')
  62.      y=n-1
  63.      If MainDir.n=Maindir.y Then
  64.        Iterate
  65.      DirList=DirList||MainDir.n' '
  66.      n=n+1
  67.   End
  68.  
  69. C=Close(Amitree)
  70.  
  71. 'REQUEST TITLE="'Titel'"
  72.          BODY "Enter name of .readme or use a file|requester to ''Browse'' for your archive?"
  73.          BUTTON="Enter|Browse|Cancel"'
  74. If Result=0 Then Call Cancel
  75.  
  76. If Result=1 Then
  77.   Do
  78.     'REQUEST STRING TITLE="'Titel'"
  79.              BODY "Enter name the of your .readme"
  80.              OLD=".readme" MAX=21 VAR=Rname'
  81.     If RC=5 Then Call Cancel
  82.     Call NewName
  83.   End
  84. Else
  85. Do
  86.   Do
  87.    'REQUEST TITLE="Please select your archive file ..."
  88.             FILE VAR=aname'
  89.     If RC=5 Then Call Cancel
  90.   End
  91.   If right(aname,4)~=".lha" Then
  92.   aname=aname||".lha"
  93.   'NAME NEW 'aname''
  94.   'QUERY PATH'
  95.    pathh=result
  96.   'QUERY FILE'
  97.    name=Result
  98.   If Length(name)>18 Then
  99.     Do  
  100.      'REQUEST TITLE="'Titel'"
  101.               BODY "Aminet limits the maximum filename length to|18 chars (including the''.lha'' suffix).|Please rename your archive."
  102.               BUTTON "Rename|No Thanks|Cancel"'
  103.       If Result=0 Then Call Cancel
  104.       If Result=1 Then
  105.         Do
  106.           'REQUEST STRING TITLE="'Titel'"
  107.                    BODY "Please amend your archive title"
  108.                    OLD "'name'" VAR nname'
  109.            If RC=5 Then Call Cancel
  110.            Address Command 'Rename 'aname pathh||nname''
  111.            Rname=pathh||Substr(name,1,Pos(".",name)-1)".readme"
  112.            Call NewName
  113.         End
  114.       Else
  115.         Do
  116.           'REQUEST TITLE="'Titel'"
  117.                    BODY "You are advised that Aminet will|trim your archive name to 18 chars|(including the ''.lha'')"
  118.                    BUTTON "NOTED"'
  119.            Rname=Substr(aname,1,Pos(".",aname)-1)".readme"
  120.            Call NewName
  121.         End
  122.     End
  123.   Else
  124.     Do
  125.       Rname=Substr(aname,1,Pos(".",aname)-1)".readme"
  126.       Call NewName
  127.     End
  128. End
  129.  
  130. Call Start
  131.  
  132. If Desc='' Then
  133.   Do
  134.     'REQUEST PROBLEM="You must have a file description"'
  135.     Call Start
  136.   End
  137.  
  138. 'REQLIST ENTRY 'DirList' VAR TYP1'
  139. If RC=5 Then Call Cancel
  140.  
  141. If Open(AmiTree,'GoldEd:ARexx/TREE',r)=1 Then
  142.   num=0
  143.   Do Until EOF(AmiTree)
  144.      List=ReadLn(AmiTree)
  145.      If Left(List,Length(TYP1))~=TYP1 Then
  146.        Iterate
  147.      Short=Delstr(List,(Index(List,' ')))
  148.      Subdir.num=compress(Substr(Short,Lastpos('/',Short)),'/')
  149.      SubList=SubList||Subdir.num' '
  150.      num=num+1
  151.   End
  152.  
  153. C=Close(Amitree)
  154.  
  155. 'REQLIST ENTRY 'Sublist' VAR TYP2'
  156. If RC=5 Then Call Cancel
  157.  
  158. 'REQUEST STRING TITLE="Requires: (OPTIONAL)" BODY="Enter any specific requirements." MAX=40 VAR=Req'
  159. If RC=5 Then Call Cancel
  160.  
  161. 'REQUEST STRING TITLE="Replaces: (OPTIONAL)" BODY="Full path of file to replace" MAX=40 VAR=Rep'
  162. If RC=5 Then Call Cancel
  163.  
  164. 'REQUEST STRING TITLE="Version: (OPTIONAL)" BODY="Enter the version number" MAX=20 VAR=Ver'
  165. If RC=5 Then Call Cancel
  166.  
  167. 'REQUEST TITLE="Distribution: (OPTIONAL)" BODY="Is it OK to put your upload|on future Aminet CDs?" BUTTON="CD OK|NO CD"'
  168.  
  169. If RESULT=0 Then Dis='NOCD'
  170. Else Dis=''
  171.  
  172. /* OK, lets put it all together and print to screen */
  173.  
  174. 'TEXT T="Short:    'Desc'" CR'
  175. 'TEXT T="Author:   'Author'" CR'
  176. 'TEXT T="Uploader: 'Uploader'" CR'
  177. 'TEXT T="Type:     'TYP1'/'TYP2'" CR'
  178. If Req>0 Then 'TEXT T="Requires: 'Req'" CR'
  179. If Rep>0 Then 'TEXT T="Replaces: 'Rep'" CR'
  180. If Ver>0 Then 'TEXT T="Version:  'Ver'" CR'
  181. If Dis>0 Then 'TEXT T="Distribution: 'Dis'" CR'
  182. 'TEXT CR'
  183.  
  184. /* All done, let's unlock the GUI and Exit */
  185. 'UNLOCK'   
  186. Exit
  187.  
  188. Start:
  189. 'REQUEST STRING TITLE="Short: (REQUIRED)" BODY="Please enter a file description" MAX=40 VAR=Desc'
  190. If RC=5 Then Call Cancel
  191. Return
  192.  
  193. NewName:
  194. 'NAME NEW 'Rname''  /* Reset the filename of the current document */
  195. Return
  196.  
  197. Cancel:
  198.  Do
  199.    'UNLOCK'
  200.     Exit
  201.  End
  202. Return
  203.  
  204. /***** End of my code *****/
  205.  
  206. SYNTAX:
  207.  
  208. Say "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
  209. 'UNLOCK'
  210. Exit
  211.